﻿using System;

namespace DatabaseConnectionExample
{
    abstract class DatabaseConnection
    {
        private string connectionString;
        public TimeSpan Timeout { get; private set; }

        public DatabaseConnection(string connectionString, TimeSpan timeout)
        {
            ConnectionString = connectionString;
            Timeout = timeout;
        }

        public string ConnectionString
        {
            get { return connectionString; }
            set
            {
                if(String.IsNullOrWhiteSpace(value))
                    throw new ArgumentException("connectionString");
                connectionString = value;
            }
        }

        public abstract void OpenConnection();

        public abstract void CloseConnection();

    }
}